﻿<%@ Page Language="C#" MasterPageFile="~/Layouts/List.Master" AutoEventWireup="true"
    Inherits="HHMMS.UI.Modules.PlanManager.PurchasePlanDocList" Title="采购计划审批单列表" CodeBehind="PurchasePlanDocList.aspx.cs" %>

<asp:Content ContentPlaceHolderID="head" ID="idFormTitle" runat="server">
    <!-- title -->
</asp:Content>

<asp:Content ID="idContent" ContentPlaceHolderID="Content" runat="Server">   
    <!-- 搜索框 -->
    <div class="search" style="margin-top:2px;">     
        <web:search ID="GridSearch" GridViewId="SmartGridView1" runat="server">            
            <SearchConditionTemplate>                                       
                <table cellpadding="0" cellspacing="0" width="95%">
                    <tr>
                        <th>
                            单据标题：
                        </th>
                        <td>
                            <asp:TextBox ID="tbTitle" runat="server"></asp:TextBox>
                        </td>
                        <th>
                            申请　人：
                        </th>
                        <td>
                            <asp:TextBox ID="tbCreator" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <th>
                            流程编号：
                        </th>
                        <td>
                            <asp:TextBox ID="tbWFInstanceId" runat="server"></asp:TextBox>
                        </td>
                        <th>
                            单据状态：
                        </th>
                        <td>
                            <web:SmartDropDownList ID="tbStatus" runat="server" DictionaryCode="PartsDiscardRecordStatus"
                                Width="155px" />
                        </td>
                    </tr>
                </table>
            </SearchConditionTemplate>                      
        </web:search>
    </div>

    <div class="datalist">
        <!-- 标题头 -->
        <h2 style="height:30px;">采购计划审批单列表</h2>
        <!-- 工具栏 -->
        <div class="toolbar"  style="height:30px;">
            <asp:LinkButton runat="server"
                OnClientClick="return showWorkflowPage(this);" OnClick="SearchGrid">
                <span>
                    <img alt="" runat="server" src="~/Images/icon_new.gif" style="border: 0px" />申请采购
                </span>
            </asp:LinkButton>
        </div>
        <div class="datagrid"  style="clear:left;">    
            <!--------------------------- List Area --------------------------->
            <web:SmartGridView ID="SmartGridView1" runat="server" AutoGenerateColumns="False"
                Width="100%" DataKeyNames="DocId" DataSourceID="SmartDataSource1" PageSize="10">
                <Columns>   
                    <asp:BoundField DataField="WFInstanceId" HeaderText="单号" SortExpression="WFInstanceId" ItemStyle-HorizontalAlign = "Center"  />
                    <asp:TemplateField HeaderText="标题">
                        <ItemTemplate>
                            <a href='../Workflow/WorkItem.aspx?instanceId=<%#Eval("WFInstanceId") %>&taskId=<%#Eval("TaskId") %>&actionType=1' target="_blank"><%#Eval("Title")%></a>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="Creator" HeaderText="申请人" SortExpression="Creator" ItemStyle-HorizontalAlign = "Center"  />
                    <asp:BoundField DataField="CreateTime" HeaderText="申请时间" SortExpression="CreateTime" ItemStyle-HorizontalAlign = "Center"  />
                    <asp:BoundField DataField="PassTime" HeaderText="审批通过时间" SortExpression="PassTime" ItemStyle-HorizontalAlign = "Center"  />
                    <asp:BoundField DataField="DiscardTime" HeaderText="作废时间" SortExpression="DiscardTime" ItemStyle-HorizontalAlign = "Center"  />
                    <web:DataDictonaryBoundField  DataField="Status" HeaderText="状态" SortExpression="Status" DictionaryCode="PartsDiscardRecordStatus" ItemStyle-HorizontalAlign = "Center"  />
                    <%--<asp:TemplateField HeaderText="操作">
                        <ItemStyle HorizontalAlign="Center" />
                        <HeaderStyle Wrap="False" HorizontalAlign="Center" />
                        <ItemTemplate>
                            <table width="46px">
                                <tr>                                    
                                    <td style="border: 0px solid #fff;">
                                        <asp:ImageButton runat="server" ToolTip="编辑" _ID='<%#Eval("DocId")%>'
                                            ImageUrl="~/images/com/dg_edit.gif" CausesValidation="False" OnClientClick="return openForm(this, 'Edit');" OnClick="RefreshGrid">
                                        </asp:ImageButton>
                                    </td>
                                    <td style="border: 0px solid #fff;">
                                        <asp:ImageButton runat="server" ToolTip="删除" ImageUrl="~/images/com/dg_del.gif" _ID='<%#Eval("DocId")%>'
                                            CausesValidation="False" OnClientClick="return confirm('您确认要删除吗?')" OnClick="DeletePurchasePlanDoc">
                                        </asp:ImageButton>
                                    </td>
                                </tr>
                            </table>
                        </ItemTemplate>
                    </asp:TemplateField>--%>
                </Columns>
                <PagerSettings />
                <EditRowStyle HorizontalAlign="Center" />
            </web:SmartGridView>
    
            <web:SmartSqlDataSource ID="SmartDataSource1" runat="server" SelectCommand="PlanManager.PurchasePlanDoc.List" SelectCountCommand="PlanManager.PurchasePlanDoc.List.Count"
                    DefaultSortExpression="DocId DESC" SelectCommandAutoPageWrap="true">
            </web:SmartSqlDataSource>
        </div>
    </div>

    <script type="text/javascript">
        function showWorkflowPage(sender) {
            var url = Global.contextPath + "/Modules/Workflow/WorkItem.aspx?workflowId=2"
            window.open(url);
            return false;
        }

        function openForm(_this, action) {
            var url;

            // FormViewMode : Insert/Edit/ReadOnly
            var params = {FormViewMode: action }
            if (action == "Insert") {
                url = "PurchasePlanDocEdit.aspx";
                params.title = "采购计划审批单新增";
            } else if (action == "Edit") {
                url = "PurchasePlanDocEdit.aspx";
                params.title = "采购计划审批单编辑";
                params.DocId = _this.attributes["_ID"].value;
            }

            var returnValue = showCenterModalDialog(buildUrl(url, params), 620, 500, null);

            return returnValue == "true";
        }       
    </script>

</asp:Content>